/**
 * 
 */
package com.lanswon.qzsmk.listener;

import java.io.UnsupportedEncodingException;

import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;

import org.apache.commons.codec.binary.Base64;
import org.slf4j.LoggerFactory;

import com.lanswon.qzsmk.exception.SystemException;

import ch.qos.logback.classic.Logger;

/**
 * 监听系统启动
 * @author sun
 *
 */
public class ListenerProject implements ServletContextListener {
	private static Logger logger = (Logger) LoggerFactory
			.getLogger(ListenerProject.class);
	
	public static String contextPath = "";

	@Override
	public void contextDestroyed(ServletContextEvent arg0) {
		// TODO Auto-generated method stub

	}

	@Override
	public void contextInitialized(ServletContextEvent arg0) {
	String g ="ICAgICAgICAgKioqKioqKioqKioqKioq5L2b56WW5L+d5L2RICAgICAgIOawuOaXoEJVRyoqKioqKioqKioqKioqKioKICAgICAgICAgKiAgICAgICAgICAgICAgICAgICAgX29vT29vXyAgICAgICAgICAgICAgICAgICAgKgogICAgICAgICAqICAgICAgICAgICAgICAgICAgIG84ODg4ODg4byAgICAgICAgICAgICAgICAgICAqCiAgICAgICAgICogICAgICAgICAgICAgICAgICAgODgiIC4gIjg4ICAgICAgICAgICAgICAgICAgICoKICAgICAgICAgKiAgICAgICAgICAgICAgICAgICAofCAtXy0gfCkgICAgICAgICAgICAgICAgICAgKgogICAgICAgICAqICAgICAgICAgICAgICAgICAgIE9cICA9ICAvTyAgICAgICAgICAgICAgICAgICAqCiAgICAgICAgICogICAgICAgICAgICAgICAgX19fXy9gLS0tJ1xfX19fICAgICAgICAgICAgICAgICoKICAgICAgICAgKiAgICAgICAgICAgICAgLicgIFxcfCAgICAgfC8vICBgLiAgICAgICAgICAgICAgKgogICAgICAgICAqICAgICAgICAgICAgIC8gIFxcfHx8ICA6ICB8fHwvLyAgXCAgICAgICAgICAgICAqCiAgICAgICAgICogICAgICAgICAgICAvICBffHx8fHwgLTotIHx8fHx8LSAgXCAgICAgICAgICAgICoKICAgICAgICAgKiAgICAgICAgICAgIHwgICB8IFxcXCAgLSAgLy8vIHwgICB8ICAgICAgICAgICAgKgogICAgICAgICAqICAgICAgICAgICAgfCBcX3wgICcnXC0tLS8nJyAgfCAgIHwgICAgICAgICAgICAqCiAgICAgICAgICogICAgICAgICAgIFwgIC4tXF9fICBgLWAgIF9fXy8tLiAvICAgICAgICAgICAgICoKICAgICAgICAgKiAgICAgICAgICBfX19gLiAuJyAgLy0tLi0tXCAgYC4gLiBfXyAgICAgICAgICAgKgogICAgICAgICAqICAgICAgIC4iIiAnPCAgYC5fX19cXzx8Pl8vX19fLicgID4nIiIuICAgICAgICAqCiAgICAgICAgICogICAgICB8IHwgOiAgYC0gXGAuO2BcIF8gL2A7LmAvIC0gYCA6IHwgfCAgICAgICoKICAgICAgICAgKiAgICAgIFwgIFwgYC0uICAgXF8gX19cIC9fXyBfLyAgIC4tYCAvICAvICAgICAgKgogICAgICAgICAqID09PT09PWAtLl9fX19gLS5fX19cX19fX18vX19fLi1gX19fXy4tJz09PT09PSAqCiAgICAgICAgICogICAgICAgICAgICAgICAgICAgIGA9LS0tPScgICAgICAgICAgICAgICAgICAgICoKICAgICAgICAgKioqKioqKioqKioqKioq6aG555uuXl5e5ZCv5YqoXl5e5oiQ5YqfKioqKioqKioqKioqKioqKio=";
	contextPath = arg0.getServletContext().getRealPath("/");
	byte[] decode =  Base64.decodeBase64(g);
        try {
			logger.info("\n"+new String(decode,"UTF-8"));
		logger.debug("init+++++++++++"+contextPath);
		logger.debug(this.getClass().getClassLoader().getResource("/").getPath());
		
		
		} catch (UnsupportedEncodingException e) {
			e.printStackTrace();
			String msg="转码异常";
			logger.error(msg);
			throw new SystemException(SystemException.UnsupportedEncodingException, msg);

		}

	}

}
